<?php
$dsn = "mysql:host=127.0.0.1;dbname=lab10";
$user = "root";
$pwd =  "123456";

try{
	$pdo = new PDO($dsn, $user, $pwd);
	$pdo->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
	echo $e->getMessage();
}

try{
	$pdo->beginTransaction();
	$stmt = $pdo->prepare("SELECT * FROM `students` WHERE `id`=:id");
	$id = 1;
	$stmt->bindParam(":id", $id, PDO::PARAM_INT);
	$stmt->execute();
	$id = 2;
	$stmt->bindParam(":id", $id, PDO::PARAM_INT);
	$stmt->execute();
	$pdo->commit();
}
catch (PDOException $e){
	$pdo->rollBack();
}
